package com.bianguo.android.apushdemo.view.wiget.popupwindow;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.OvershootInterpolator;
import android.view.animation.TranslateAnimation;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bianguo.android.apushdemo.R;
import com.bianguo.android.apushdemo.utils.ScreenUtil;

import org.w3c.dom.Text;

import butterknife.BindView;

/**
 * Created by Administrator on 2017/9/4.
 */

public class CommentPopup extends BasePopupWindow implements View.OnClickListener {

    @BindView(R.id.popup_anim_layout)
    LinearLayout popupAnimLayout;
    @BindView(R.id.popup_select_1)
    TextView select1Tv;
    @BindView(R.id.popup_select_2)
    TextView select2Tv;
    @BindView(R.id.popup_select_3)
    TextView select3Tv;
    @BindView(R.id.popup_select_4)
    TextView select4Tv;

    public CommentPopup(Activity mContext) {
        this(mContext, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    }

    public CommentPopup(Activity mContext, int w, int h) {
        super(mContext, w, h);

        select1Tv.setOnClickListener(this);
        select2Tv.setOnClickListener(this);
        select3Tv.setOnClickListener(this);
        select4Tv.setOnClickListener(this);
    }

    @Override
    public View getPopupView() {
        return LayoutInflater.from(mContext).inflate(R.layout.popup_select_layout, null);
    }

    @Override
    public View getAnimView() {
        return popupAnimLayout;
    }

    @Override
    public View getDismissView() {
        return null;
    }

    @Override
    public Animation getShowAnimation() {
        TranslateAnimation translateAnimation = new TranslateAnimation(0f, 0f, -ScreenUtil.dip2px(mContext, 350f), 0);
        translateAnimation.setDuration(450);
        translateAnimation.setInterpolator(new OvershootInterpolator(1));
        return translateAnimation;
    }

    @Override
    public void onClick(View v) {
        if (onClickBtnListener != null) {
            onClickBtnListener.onClickBtn(v);
        }
    }
}
